from cx_Freeze import setup, Executable
import os
import sys

# 获取虚拟环境路径
venv_path = os.path.dirname(os.path.dirname(sys.executable))
venv_site_packages = os.path.join(venv_path, 'Lib', 'site-packages')

# 添加搜索路径
current_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.extend([current_dir, venv_site_packages])

build_exe_options = {
    "packages": [
        "os", "sqlite3", "prompt_toolkit", "colorama", 
        "tabulate", "re", "encodings", "pkg_resources",
        "wcwidth", "codecs", "io"
    ],
    "includes": ["sqlite_cli", "formatter", "completer", "constants"],
    "include_files": [
        ("sqlite_cli.py", "sqlite_cli.py"),
        ("formatter.py", "formatter.py"),
        ("completer.py", "completer.py"),
        ("constants.py", "constants.py")
    ],
    "include_msvcr": True,
    "optimize": 0,
    "build_exe": "dist"
}

setup(
    name="sqlite-cli",
    version="1.0.0",
    description="SQLite CLI 工具",
    options={"build_exe": build_exe_options},
    executables=[
        Executable(
            script="run.py",
            base="Console",
            target_name="sqlite-cli.exe"
        )
    ]
)